package com.tidudada.shopping;


import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import tidudada.com.ShoppingApplication;

@SpringBootTest(classes = ShoppingApplication.class)
@RunWith(SpringJUnit4ClassRunner.class)
public class SetValue {

    @Autowired
    private RedisTemplate<String,String> redisTemplate;

    @Test
    public void show(){
        ValueOperations<String, String> stringStringValueOperations = redisTemplate.opsForValue();
        stringStringValueOperations.set("commodity",100+"");
    }

    @Test
    public void show2(){
        String commodity = redisTemplate.opsForValue().get("commodity");
        System.out.println(commodity);
    }


}
